//
// Created by leslie on 11/10/15.
//

#ifndef CEPOLL_CEPOLLSERVER_H
#define CEPOLL_CEPOLLSERVER_H

#include <sys/epoll.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <pthread.h>
#include <string.h>
#include <unistd.h>

#define _MAX_SOCKFD_COUNT 65535

class CEpollServer
{
public:
    CEpollServer();
    ~CEpollServer();

    bool InitServer(const char* chIp, int iPort);

   //void Listen(void* ipVoid);
    static void ListenThread(void* lpvoid);
    void Run();

private:
    int m_iEpollFd;
    int m_isock;
    pthread_t  m_ListenThreadId;//the fd of the listening socket

};



#endif //CEPOLL_CEPOLLSERVER_H
